﻿using MediatR;
using RBAC.Domain.Service.Interfae;
using RBACDuYaJun.Api.Appliction.Command.UserRoleCommand;

namespace RBACDuYaJun.Api.Appliction.CommandHandlers.UserRoleHanders
{
    public class UserRoleDeleteCommandHandler : IRequestHandler<UserRoleDeleteCommand, int>
    {
        private readonly IUserRoleService _userRoleService;
        public UserRoleDeleteCommandHandler(IUserRoleService userRoleService)
        {
            _userRoleService = userRoleService;
        }

        public async Task<int> Handle(UserRoleDeleteCommand request, CancellationToken cancellationToken)
        {
            return await _userRoleService.DeleteUserRoles(request.UserRoleId);
        }
    }
}
